package _5thread;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLongArray;
import java.util.concurrent.atomic.LongAdder;

/**
 * @Description:
 * @Author wangzhen
 * @Date 2022-06-16 21:29
 **/
public class AtomicIntegerTest {

    static AtomicInteger age=new AtomicInteger(2);
    public static void main(String[] args) throws Exception {


        new Thread(()->{
            System.out.println(Thread.currentThread().getName()+"准备修改:"+age.get());
            int get = age.incrementAndGet();
            System.out.println(Thread.currentThread().getName()+"操作完成:"+get);

        }).start();

        new Thread(()->{
            System.out.println(Thread.currentThread().getName()+"准备修改:"+age.get());
            int get = age.incrementAndGet();
            System.out.println(Thread.currentThread().getName()+"操作完成:"+get);

        }).start();


    }



}
